import axios from 'axios'
function request(obj) {
    return new Promise((resolve,reject) => {
        let data = {}
        let { method, url, params } = obj
        if (method === 'post') {
            // console.log(obj);
            axios.post(url, params).then(res => {
                data = res.data
                resolve(data)
            })
        } else {
            axios.get(url, params).then(res => {
                data = res.data
                resolve(data)
            })
        }
        
    })
}
export default request